package site.kexing.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import site.kexing.config.MybaitsUtils;
import site.kexing.mapper.RegisterMapper;
import site.kexing.pojo.User;

import java.util.Date;

@Controller
public class RegisterController {
    @Autowired
    private RegisterMapper registerMapper;

    @RequestMapping("/insertuser")
    public String insertUser(User user){
        user.setFlag(1);
        user.setCreate_time(new Date());
        user.setUser_status(0);
        user.setUser_job_num(MybaitsUtils.getUUID());
        int i = registerMapper.insertUser(user);
        if(i == 1){
            return "redirect:/login";
        }return "redirect:/register";
    }
}
